<?php
use \tpfcore\Core;
?>
<!doctype html>
<head>
		<meta charset="utf-8">
		<!-- Set render engine for 360 browser -->
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<!-- HTML5 shim for IE8 support of HTML5 elements -->
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js">
			</script>
		<![endif]-->
		<link href="{$admin_assets_path}/css/theme.min.css" rel="stylesheet">
		<link href="{$admin_assets_path}/css/simplebootadmin.css" rel="stylesheet">
		<link href="{$admin_assets_path}/css/default.css" rel="stylesheet" />
		<link href="{$admin_assets_path}/css/font-awesome.min.css" rel="stylesheet" type="text/css">
		<style>
			.length_3{width: 180px;} form .input-order{margin-bottom: 0px;padding:3px;width:40px;}
			.table-actions{margin-top: 5px; margin-bottom: 5px;padding:0px;} .table-list{margin-bottom:
			0px;}
		</style>
		<!--[if IE 7]>
			<link rel="stylesheet" href="{$admin_assets_path}/css/font-awesome-ie7.min.css">
		<![endif]-->
		<script type="text/javascript">
			//全局变量
			var GV = {
				WEB_ROOT:"",
				DIMAUB: "/",
				JS_ROOT: "/theme/backend/assets/js/",
				TOKEN: ""
			};
		</script>
		<!-- Le javascript==================================================-
		-> <!-- Placed at the end of the document so the pages load faster -->
		<script src="{$admin_assets_path}/js/jquery.js"></script>
		<script src="{$admin_assets_path}/js/wind.js"></script>
		<script src="{$admin_assets_path}/js/bootstrap.min.js"></script>
		<script src="{$admin_assets_path}/kindeditor/kindeditor-min.js"></script>
		<link href="{$admin_assets_path}/kindeditor/themes/default/default.css" rel="stylesheet"/>
	</head>
<script>
	KindEditor.ready(function(K) {
		var uploadbutton = K.uploadbutton({
			button : K('#uploadButton')[0],
			fieldName : 'imgFile',
			url:"{:Core::addons_url('cms://MiniColumn/upload')}",
			afterUpload : function(data) {
				if (data.code === 0) {
					var url = K.formatUrl(data.data[0], 'absolute');
							K('#url').val(url);
							$('#show_thumb').attr('src',url).show();
						} else {
							alert(data.msg);
						}
					},
					afterError : function(str) {
						alert('自定义错误信息: ' + str);
					}
			});
			uploadbutton.fileBox.change(function(e) {
			uploadbutton.submit();
		});
	});
</script>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('cms/MiniColumn/index')}">栏目管理</a></li>
			{notempty name="list"}
			<li><a href="{:url('cms/MiniColumn/add_edit')}">添加栏目</a></li>
			<li class="active"><a href="{:url('cms/MiniColumn/add_edit',['id'=>$list[0]['id']])}">编辑栏目</a></li>
			{else/}
			<li class="active"><a href="{:url('cms/MiniColumn/add_edit')}">添加栏目</a></li>
			{/notempty}
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="">
			{notempty name="list"}
			<input type="hidden" name="id" value="{$list[0]->id}"/>
			{/notempty}
			<fieldset>
				<div class="control-group">
					<label class="control-label">栏目标题</label>
					<div class="controls">
						<input type="text" name="title" value="{$list[0]->title|default=''}">
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">栏目图标</label>
					<div class="controls">
						<input class="ke-input-text" type="text" id="url" value="{$list[0]->img|default=''}" name='img' readonly="readonly" /> 
						<input type="button" id="uploadButton" value="上传图标" />
						{empty name="list"}
						<img src="{$list[0]->img|default=''}" style="width:50px;height:50px; display:none;" id="show_thumb"/>
						{else}
						{notempty name="list[0]->img"}
						<img src="{$list[0]->img}" style="width:50px;height:50px;" id="show_thumb"/>
						{else/}
						<img src="{$list[0]->img|default=''}" style="width:50px;height:50px; display:none;" id="show_thumb"/>
						{/notempty}
						{/empty}
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">微信链接地址</label>
					<div class="controls">
						<input type="text" name="wechat_url" value="{$list[0]->wechat_url|default=''}">
						<span class="form-required">* 这里微信链接形式，微信订阅号、公众号里面使用</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">小程序链接地址</label>
					<div class="controls">
						<input type="text" name="url" value="{$list[0]->url|default=''}">
						<span class="form-required">* 这里是小程序内的链接形式</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">绑定事件(触发功能)</label>
					<div class="controls">
						<input type="text" name="bindtap" value="{$list[0]->bindtap|default=''}">
						<span class="form-required">* 执行已定义好的事件函数，目前有(callMe-打电话)</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">排序</label>
					<div class="controls">
						<input type="text" name="sort" value="{$list[0]->sort|default='1'}">
						<span class="form-required">* </span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">是否显示</label>
					<div class="controls">
						{empty name="list"}
						<label><input type="radio" name="display" value="1" checked>显示</label>
						<label><input type="radio" name="display" value="0">不显示</label>
						{else/}
						<label><input type="radio" name="display" value="1" {eq name="list[0]->display" value="1"}checked{/eq}>显示</label>
						<label><input type="radio" name="display" value="0" {eq name="list[0]->display" value="0"}checked{/eq}>不显示</label>
						{/empty}
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">链接到主导航</label>
					<div class="controls">
						{empty name="list"}
						<label><input type="radio" name="to_tabbar" value="1">是</label>
						<label><input type="radio" name="to_tabbar" value="0" checked>否</label>
						{else/}
						<label><input type="radio" name="to_tabbar" value="1" {eq name="list[0]->to_tabbar" value="1"}checked{/eq}>是</label>
						<label><input type="radio" name="to_tabbar" value="0" {eq name="list[0]->to_tabbar" value="0"}checked{/eq}>否</label>
						{/empty}
					</div>
				</div>
			</fieldset>
			<div class="form-actions">
				<button class="btn btn-primary js-ajax-button" type="button">确定操作</button>
				<a class="btn" href="javascript:history.back(-1);">返回</a>
			</div>
		</form>
	</div>
	<script src="{$admin_assets_path}/js/common.js"></script>
</body>
</html>